<!-- ![Error 31-4302 when entering the door after login](LOGO-IF-E31-4302.jpg) -->
![Playable](LOGO-IF-WORKING.jpg)
<!-- ![Work in progress](LOGO-IF-WIP.jpg) -->  
[![License](https://img.shields.io/badge/License-MIT-orange.svg)](https://shields.io/)
[![Supported versions](https://img.shields.io/badge/Latest_supported_version-1.5.1-orange.svg)](https://shields.io/)

# Table of Contents
* **[Introduction to GI-on-Linux](#introduction-to-gi-on-linux)**
* **[What this patch does](#what-this-patch-does)**
* **[Project guidelines](#project-guidelines)**
* **[Installing the game](#installing-the-game)**
* **[Applying the patch](#applying-the-patch)**
* **[Tools](#tools)**
* **[Tweaks](#tweaks)**
* **[Troubleshooting](#troubleshooting)** 
* **[Contributing](#contributing)**
* **[Credits](#credits)**

## <a name="whatis"></a>Introduction to GI-on-Linux
GI-on-Linux is a community effort to create patches and tools to make [Genshin Impact](https://genshin.mihoyo.com/) playable on a GNU/Linux system through Wine. We also have tools to facilitate maintenance and updates.

So far, our efforts were successful and Genshin Impact should run at near native performance for most people, and with complete functionality.

**NOTE: The Chinese variant (Yuanshen) is not yet supported due to missing information, see [Issue#22](https://notabug.org/Krock/GI-on-Linux/issues/22)**

## <a name="patch"></a>What this patch does

`mhyprot2.sys` is a kernel service which is and will not be supported by Wine. Problem: it's used as cheat detection, and without it, the game will simply not open.

#### Available solutions:

 * Wine + patched game **(what this project does)**
 * Dual-boot to Windows
 * [Use Hyper-V in a Windows VM](https://youtu.be/L1JCCdo1bG4?t=191)
 * Play another game. Format: link, caveats (Proton/Wine rating)
 * Blue Protocol, unreleased, 2021/22 (N/A)
 * [Little Witch Nobeta](https://store.steampowered.com/app/1049890/Little_Witch_Nobeta/) singleplayer (Gold)
 * [Ashen](https://store.steampowered.com/app/649950/Ashen/) ~$40 (Platinum)
 * [Tower Hunter: Erza's Trial](https://store.steampowered.com/app/844850/Tower_Hunter_Erzas_Trial/) singleplayer (Platinum)
 * [Haven](https://www.gog.com/game/haven) PEGI 18 (N/A, too new)
 * [Valheim](https://store.steampowered.com/app/892970/Valheim/) no story (Native)
 * [Pine](https://www.gog.com/game/pine) no story, singleplayer (Native)

This patch allows the game to run without `mhyprot2.sys`, by spoofing some values to make the game think it's running on a normal Windows system.

## <a name="rules"></a>Project guidelines

 1. miHoYo reserves the right to distribute files. Please do not share any game data in public.
 2. For your own sake: **Do not share this project in official channels.** Why?

    * Reduces the risk of this project to be taken down or used against our reverse-engineering efforts
    * Solution: Use indirect/redirect links and private messages

 3. Please do not abuse this project for cheating. We just want to play the game.
 5. **(For project contributors)** Beware that your log files may contain personal information, such as MAC addresses or login data. Snip any sensitive data beforehand to enforce your privacy.

Please **do not report any** game issues to an official channel. Your options are:

 * [Troubleshooting](#troubleshooting) page for common issues and solutions
 * Create a [new issue](https://notabug.org/Krock/GI-on-Linux/issues) here. See also: [closed/solved issues](https://notabug.org/Krock/GI-on-Linux/issues?state=closed&labels=2029)
 * Post your problem on a Wine/dxvk-specific page

## <a name="installgame"></a>Installing the game
This page contains instructions for getting the vanilla game installed on Linux (via Lutris, for example). However, without the patch, you will not be able to play.

[See dedicated page](INSTALLATION.md)
    
## <a name="installpatch"></a>Applying the patch

You will want to follow these steps on the terminal.
	
    # Download the repository (or use the download button) to your home folder, or anywhere else you want.
	git clone https://notabug.org/Krock/GI-on-Linux
    # Go to the folder the game files are in. This is an example:
	cd "(your wineprefix)/drive_c/Program Files/Genshin Impact/Genshin Impact game/"
    # Apply the main patch (assuming it is in your home folder).
    # For example, if you updated to 1.5.1, change (game version) to 151.
	bash "$HOME/GI-on-Linux/(game version)/patch.sh"
	# Apply the patch that fixes a crash when entering the door
	bash "$HOME/GI-on-Linux/(game version)/patch_anti_logincrash.sh"

Once it's all done, you should have a launcher.bat on the game folder to launch it with.   

The patches can be reverted using the included `patch_revert.sh` in the same manner.

## <a name="tools"></a>Tools
The repository comes with the following additional tools:
* [An updater for Genshin Impact](https://notabug.org/Krock/GI-on-Linux/src/master/updater)
    * You can use it instead of the official launcher.exe to get new updates.
    * If you don't want to, the official launcher.exe is at `(your wineprefix)/drive_c/Program Files/Genshin Impact`

## <a name="tweaks"></a>Tweaks
A list of tweaks you can do to the game under Linux to improve visuals, performance, etc.  
Most Linux users do love to tinker, after all.

[See dedicated page](TWEAKS.md)

## <a name="troubleshooting"></a>Troubleshooting
An (extensive?) list of problems you may face and possible solutions.

[See dedicated page](TROUBLESHOOTING.md)

## <a name="contributing"></a>Contributing
#### Reporting issues
If you would like to help us, check the open tasks on the [issue tracker](https://notabug.org/Krock/GI-on-Linux/issues?labels=2024). You can also make a new issue to report problems with the game, if you believe they are related to the patch or Wine.

#### Development
Some information might be missing from the Markdown files. Be sure to check the comments on older issues, for additional info on the game's inner workings.  
* [Reverse engineering tools](TOOLS.md)
* [Mostly up-to-date journal](110/JOURNAL.md)

## <a name="credits"></a>Credits
A list of people that contributed their time to the project.  
GI-on-Linux is a community effort.

[See dedicated page](CREDITS.md)
